"""
游戏常量定义模块。
包含游戏中使用的所有常量值。
"""
from typing import Dict, List, Tuple

# 屏幕设置
SCREEN_WIDTH = 1000
SCREEN_HEIGHT = 700
BOARD_WIDTH = 10  # 每个玩家的游戏板宽度
BOARD_HEIGHT = 20  # 游戏板高度
BLOCK_SIZE = 25  # 方块大小(像素)

# 颜色 (R, G, B)
BLACK = (0, 0, 0)
WHITE = (255, 255, 255)
GREY = (128, 128, 128)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
CYAN = (0, 255, 255)
MAGENTA = (255, 0, 255)
YELLOW = (255, 255, 0)
ORANGE = (255, 165, 0)

# 每种方块的颜色
COLORS: Dict[str, Tuple[int, int, int]] = {
    'I': CYAN,
    'J': BLUE,
    'L': ORANGE,
    'O': YELLOW,
    'S': GREEN,
    'T': MAGENTA,
    'Z': RED
}

# 方块形状定义 (相对坐标)
SHAPES: Dict[str, List[List[Tuple[int, int]]]] = {
    'I': [[(0, 0), (0, 1), (0, 2), (0, 3)],  # 竖直
          [(0, 0), (1, 0), (2, 0), (3, 0)]],  # 水平
          
    'J': [[(0, 0), (0, 1), (0, 2), (-1, 2)],  # 左下角
          [(0, 0), (1, 0), (2, 0), (2, 1)],
          [(0, 0), (1, 0), (1, -1), (1, -2)],
          [(0, 0), (0, 1), (-1, 0), (-2, 0)]],
          
    'L': [[(0, 0), (0, 1), (0, 2), (1, 2)],  # 右下角
          [(0, 0), (1, 0), (2, 0), (0, 1)],
          [(0, 0), (1, 0), (1, 1), (1, 2)],
          [(0, 0), (0, 1), (1, 1), (2, 1)]],
          
    'O': [[(0, 0), (0, 1), (1, 0), (1, 1)]],  # 方块
    
    'S': [[(0, 0), (0, 1), (1, 1), (1, 2)],
          [(0, 0), (1, 0), (-1, 1), (0, 1)]],
          
    'T': [[(0, 0), (0, 1), (-1, 1), (1, 1)],
          [(0, 0), (0, 1), (0, 2), (1, 1)],
          [(0, 0), (-1, 0), (1, 0), (0, -1)],
          [(0, 0), (0, 1), (0, 2), (-1, 1)]],
          
    'Z': [[(0, 0), (0, 1), (-1, 1), (-1, 2)],
          [(0, 0), (1, 0), (1, 1), (2, 1)]]
}

# 游戏控制
FPS = 60  # 游戏帧率
INITIAL_FALL_SPEED = 0.5  # 初始下落速度 (方块/秒)
LEVEL_SPEEDUP_FACTOR = 0.9  # 每升一级速度变为原来的多少倍
LINES_PER_LEVEL = 10  # 每消除多少行升一级

# 玩家1控制键
P1_KEYS = {
    'LEFT': 'a',
    'RIGHT': 'd',
    'DOWN': 's',
    'ROTATE': 'w',
    'DROP': 'space'
}

# 玩家2控制键
P2_KEYS = {
    'LEFT': 'left',
    'RIGHT': 'right',
    'DOWN': 'down',
    'ROTATE': 'up',
    'DROP': 'return'
}

# 游戏状态
GAME_STATE_MENU = 0
GAME_STATE_PLAYING = 1
GAME_STATE_PAUSED = 2
GAME_STATE_GAME_OVER = 3 